﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace RiskMan.DataClass.AlfaDirectFolder
{
    /// <summary>
    /// ТАБЛИЦА «PAPERS» - СПРАВОЧНИК ФИНАНСОВЫХ ИНСТРУМЕНТОВ
    /// Ключевое поле: paper_no
    /// </summary>
    class Papers : INotifyPropertyChanged
    {
        #region Private

        private int _paperNo;
        private string _pCode;
        private string _placeCode;
        private string _tsPCode;
        private string _boardCode;
        private int _lotSize;
        private int _decimal;
        private string _allowShort;
        private double _priceStep;
        private double _goBuy;
        private double _goSell;
        private double _priceStepCost;
        private string _ansiName;
        private string _atCode;
        private string _placeName;
        private string _currCode;

        #endregion

        #region Public

        /// <summary>
        /// Цифровой код финансового инструмента.
        /// </summary>
        public int PaperNo
        {
            get { return _paperNo; }
            set
            {
                if (_paperNo != value)
                    _paperNo = value;

                RaisePropertyChanged("PaperNo");
            }
        }
        /// <summary>
        /// Код актива.
        /// </summary>
        public string PCode
        {
            get { return _pCode; }
            set
            {
                if (_pCode != value)
                    _pCode = value;

                RaisePropertyChanged("PCode");
            }
        }
        /// <summary>
        /// Код рынка.
        /// </summary>
        public string PlaceCode
        {
            get { return _placeCode; }
            set
            {
                if (_placeCode != value)
                    _placeCode = value;

                RaisePropertyChanged("PlaceCode");
            }
        }
        /// <summary>
        /// Торговый код инструмента.
        /// </summary>
        public string TsPCode
        {
            get { return _tsPCode; }
            set
            {
                if (_tsPCode != value)
                    _tsPCode = value;

                RaisePropertyChanged("TsPCode");
            }
        }
        /// <summary>
        /// Код торгового раздела.
        /// </summary>
        public string BoardCode
        {
            get { return _boardCode; }
            set
            {
                if (_boardCode != value)
                    _boardCode = value;

                RaisePropertyChanged("BoardCode");
            }
        }
        /// <summary>
        /// Размер лота.
        /// </summary>
        public int lotSize
        {
            get { return _lotSize; }
            set
            {
                if (_lotSize != value)
                    _lotSize = value;

                RaisePropertyChanged("lotSize");
            }
        }
        /// <summary>
        /// Количество знаков в дробной части.
        /// </summary>
        public int Decimal
        {
            get { return _decimal; }
            set
            {
                if (_decimal != value)
                    _decimal = value;

                RaisePropertyChanged("Decimal");
            }
        }
        /// <summary>
        /// Возможна короткая позиция («Y» - да, «N» - нет).
        /// </summary>
        public string AllowShort
        {
            get { return _allowShort; }
            set
            {
                if (_allowShort != value)
                    _allowShort = value;

                RaisePropertyChanged("AllowShort");
            }
        }
        /// <summary>
        /// Шаг цены.
        /// </summary>
        public double PriceStep
        {
            get { return _priceStep; }
            set
            {
                if (_priceStep != value)
                    _priceStep = value;

                RaisePropertyChanged("PriceStep");
            }
        }
        /// <summary>
        /// Гарантийное обеспечение покупки.
        /// </summary>
        public double GoBuyl
        {
            get { return _goBuy; }
            set
            {
                if (_goBuy != value)
                    _goBuy = value;

                RaisePropertyChanged("GoBuyl");
            }
        }
        /// <summary>
        /// Гарантийное обеспечение продажи.
        /// </summary>
        public double GoSell
        {
            get { return _goSell; }
            set
            {
                if (_goSell != value)
                    _goSell = value;

                RaisePropertyChanged("GoSell");
            }
        }
        /// <summary>
        /// Стоимость шага цены.
        /// </summary>
        public double PriceStepCost
        {
            get { return _priceStepCost; }
            set
            {
                if (_priceStepCost != value)
                    _priceStepCost = value;

                RaisePropertyChanged("PriceStepCost");
            }
        }
        /// <summary>
        /// Короткое название.
        /// </summary>
        public string AnsiName
        {
            get { return _ansiName; }
            set
            {
                if (_ansiName != value)
                    _ansiName = value;

                RaisePropertyChanged("AnsiName");
            }
        }
        /// <summary>
        /// Код типа актива.
        /// </summary>
        public string AtCode
        {
            get { return _atCode; }
            set
            {
                if (_atCode != value)
                    _atCode = value;

                RaisePropertyChanged("AtCode");
            }
        }
        /// <summary>
        /// Название рынка.
        /// </summary>
        public string PlaceName
        {
            get { return _placeName; }
            set
            {
                if (_placeName != value)
                    _placeName = value;

                RaisePropertyChanged("PlaceName");
            }
        }
        /// <summary>
        /// Код валюты котировок.
        /// </summary>
        public string CurrCode
        {
            get { return _currCode; }
            set
            {
                if (_currCode != value)
                    _currCode = value;

                RaisePropertyChanged("CurrCode");
            }
        }

        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
